<?php 

  	require_once "Controller.php";
 	require_once "Home/Model/userModel.php";
	 class UserController extends Controller
	 {
	 	//private $mod;

	 	function __construct()
	 	{
	 		parent::__construct();
	 		$this->mod = new userModel();
	 		//$mod = "user";
	 	}
	 	public function index()
	 	{
	 		$this -> display();
	 	}
	 	
	 	public function userform(){
		$this->display();
	}
	public function adduser(){
		$result=$this->mod->addUserInfo($_POST);
		if($result==true){
			echo "添加成功！<br>";
			echo "<a href='index.php?c=index&m=index'>如果没有跳转，请点这里跳转</a>";
		}
		else{
			echo "添加失败！<br>";
			echo "<a href='index.php?c=user&m=userform'>如果没有跳转，请点这里跳转</a>";
			
		}
	}//adduser end

	//修改用户的信息
	public function edituser(){
		
		$data=$this->mod->getUserbyID();
		$this->assign('user',$data);
		$this->display();
	}
	public function updateuser(){
		$result=$this->mod->updateUserInfo();
		if($result==true)
		echo "更新成功！<br>";
		echo ' <a href="index.php?c=index&m=index">如果没有跳转，请点这里跳转</a>';	
	}

	 }

 ?>